load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "clisqlclient",
    srcs = [
        "api.go",
        "conn.go",
        "context.go",
        "copy.go",
        "doc.go",
        "init_conn_error.go",
        "make_query.go",
        "parse_bool.go",
        "row_type_helpers.go",
        "rows.go",
        "rows_multi.go",
        "statement_diag.go",
        "string_to_duration.go",
        "txn_shim.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/cli/clisqlclient",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/build",
        "//pkg/cli/clicfg",
        "//pkg/cli/clierror",
        "//pkg/security/pprompt",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/scanner",
        "//pkg/sql/sem/catconstants",
        "//pkg/util/version",
        "@com_github_cockroachdb_cockroach_go_v2//crdb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_jackc_pgconn//:pgconn",
        "@com_github_jackc_pgtype//:pgtype",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_otan_gopgkrb5//:gopgkrb5",
    ],
)

go_test(
    name = "clisqlclient_test",
    srcs = [
        "conn_test.go",
        "main_test.go",
        "parse_bool_test.go",
        "string_to_duration_test.go",
    ],
    embed = [":clisqlclient"],
    deps = [
        "//pkg/build",
        "//pkg/cli",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/util/leaktest",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
